package jdbcmigration;

public class Table {

    private String database;
    private String tableName;
    private Column[] columns;

    public Table() {
        database = null;
        tableName = null;
        columns = null;
    }

    public Table(String database, String tableName, Column[] columns) {
        Validator.notNull(database, "String database cannot be null");
        Validator.notNull(tableName, "String tableName cannot be null");
        Validator.notNull(columns, "Columns can not be null");
        Validator.isTrue(columns.length > 0, "Must include at least one column in Tables :"  +  tableName);
        this.database = database;
        this.tableName = tableName;
        this.columns = columns;
    }

    public void setTable(String database, String tableName, Column[] columns) {
        Validator.notNull(database, "String database cannot be null");
        Validator.notNull(tableName, "String tableName cannot be null");
        Validator.notNull(columns, "Columns can not be null");
        Validator.isTrue(columns.length > 0, "Must include at least one column");
        this.database = database;
        this.tableName = tableName;
        this.columns = columns;
    }

    public String getDatabaseName() {
        return database;
    }

    public String getTableName() {
        return tableName;
    }

    public Column[] getColumns() {
        return columns;
    }
}
